﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManageUser.aspx.cs" Inherits="CocisWeb.admin.ManageUser" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>User Information Management</title>
    <link href="../css/cont.css" rel="stylesheet" type="text/css" />
    <meta content="MSHTML 6.00.2900.5848" name="GENERATOR" />
   
        <script type="text/javascript">
//单击行，行信息插入文本框事件
    function gvselchange(userId,userName,eName,sex,deptId,roleId,officeTel,shortTel,mobile,email,workCity)
    {

        document.getElementById("<%=TextBoxLoginName.ClientID %>").value = userId;
        document.getElementById("<%=TextBoxCName.ClientID %>").value = userName;
        document.getElementById("<%=txtEName.ClientID %>").value = eName;
        document.getElementById("<%=ddlSex.ClientID %>").value = sex;
        document.getElementById("<%=DropDownListRole.ClientID %>").value=roleId;
        document.getElementById("<%=DropDownListDept.ClientID %>").value = deptId;
        document.getElementById("<%=txtOfficeTel.ClientID %>").value = officeTel;
        document.getElementById("<%=txtShortTel.ClientID %>").value = shortTel;
        document.getElementById("<%=txtPhone.ClientID %>").value = mobile;
        document.getElementById("<%=txtEmail.ClientID %>").value = email;
        document.getElementById("<%=txtWorkCity.ClientID %>").value = workCity;

      }
    function checkAdd() {
       
        var CName = document.getElementById("TextBoxCName");
       



        if ( CName.value == "" ) {
            alert('请输入姓名！');
            return false;
        }
        else {
            return true;


        }
    }

    function checkUpdate() {
        
        var LoginName = document.getElementById("TextBoxLoginName");
        var CName = document.getElementById("TextBoxCName");
       

        if (LoginName.value == "") {
            alert('请选择要修改的员工！');
            return false;

        }
        else {
            if (CName.value=="") {
                alert('请输入完整信息！');
                
                return false;
            }
            else {
                return true;
            }

        }
    }

    function checkUpdates() {

        var LoginName = document.getElementById("TextBoxLoginName");
       
        if (LoginName.value == "") {
            alert('请选择要初始化的员工！');
            return false;

        }
        else {
           
                return true;
        }
    }


    function checkDelete() {
        var id = document.getElementById("TextBoxLoginName");
        if (id.value == "") {
            alert('请选择要删除的员工！');
            return false;

        }
        else {
            if (confirm('确认要删除吗？')) {
                return true;
            }
            else {
                return false;
            }


        }

    }



</script>
</head>
<body style="padding-left:5px;padding-right:5px;background-image:url(../images/bg.gif);	background-repeat:repeat-x;">
  <form id="form1" runat="server">
  <table style="height:100%; width:100%;" border="0px" cellpadding="0px" cellspacing="0px">
  <tr style="background-image: url(../images/bg_header.gif); background-repeat: repeat-x; height:47px">
  <td style="width:10px;background-image: url(../images/main_hl.gif);"></td>
  <td>
  <span style="float: left; background-image: url(../images/main_hl2.gif); width: 15px; background-repeat: no-repeat; height: 47px"></span>
      <span style="padding-right: 10px; padding-left: 10px; float: left; background-image: url(../images/main_hb.gif); line-height:47px; color: white; background-repeat: repeat-x; height: 47px; text-align: center;">
      User Management </span>
      <span style="float: left; background-image: url(../images/main_hr.gif); width: 60px; background-repeat: no-repeat; height: 47px"></span>
  </td>
  <td style="background-image: url(../images/main_hr2.gif);width:10px"></td>
  </tr>
  <tr>
  <td style="background-image: url(../images/main_ls.gif)"></td>
  <td style="padding-right: 10px; padding-left: 10px; padding-bottom: 10px; color: #566984; padding-top:10px; background-color: white;">
             
                
             <fieldset>  <br />          
                &nbsp;UserID：&nbsp;<asp:TextBox 
                     ID="TextBoxLoginName" runat="server" 
                    Width="50px" BackColor="#CCFFCC"></asp:TextBox>
                    &nbsp; UserName：<asp:TextBox ID="TextBoxCName" runat="server" Width="111px" ></asp:TextBox>
                    &nbsp;EnglishName：<asp:TextBox 
                     ID="txtEName" runat="server" Width="112px"></asp:TextBox>
                     &nbsp;Sex：<asp:DropDownList 
                     ID="ddlSex" runat="server">
                     <asp:ListItem>Male</asp:ListItem>
                     <asp:ListItem>Female</asp:ListItem>
                 </asp:DropDownList>
                &nbsp;Department：<asp:DropDownList ID="DropDownListDept" runat="server">
                </asp:DropDownList>
                             &nbsp;Role：<asp:DropDownList ID="DropDownListRole" runat="server">
                </asp:DropDownList>
                <br />
                <br />
                &nbsp;Region：<asp:TextBox ID="txtWorkCity" runat="server" Width="80px"></asp:TextBox>
                &nbsp;OfficeTel：<asp:TextBox ID="txtOfficeTel" runat="server" Width="120px"></asp:TextBox>
                &nbsp;Extension：<asp:TextBox ID="txtShortTel" runat="server"></asp:TextBox>
                &nbsp;Mobile：<asp:TextBox ID="txtPhone" runat="server" Width="111px"></asp:TextBox>
                &nbsp;Email：<asp:TextBox ID="txtEmail" runat="server" Width="150px"></asp:TextBox>
                <br />
                <br />
                &nbsp;<asp:Button ID="ButtonAdd" runat="server" 
                    CssClass="button_normal" Text="ADD" 
                    Width="40px" onclick="ButtonAdd_Click" 
                    onclientclick="javascript:if(checkAdd()){return true;}else{return false;}" />
&nbsp;&nbsp;  
                <asp:Button ID="ButtonAlter" runat="server" 
                    CssClass="button_normal" Text="EDIT" 
                    Width="46px" Height="18px" onclick="ButtonAlter_Click" 
                    onclientclick="javascript:if(checkUpdate()){return true;}else{return false;}" />
                &nbsp;&nbsp;&nbsp;<asp:Button ID="ButtonDelete" runat="server" 
                    CssClass="button_normal" Text="DELETE" 
                    Width="60px" onclick="ButtonDelete_Click" 
                    onclientclick="javascript:if(checkDelete()){return true;}else{return false;}" />
                 &nbsp;&nbsp;
                 <asp:Button ID="btnRePassword" runat="server" 
                    CssClass="button_normal" Text="初始化密码" 
                    Width="70px" onclick="btnRePassword_Click" 
                    
                     onclientclick="javascript:if(checkUpdates()){return true;}else{return false;}" />
                 <br />
                 <br />  </fieldset
      <br />
    <fieldset style="width:1077px">
<legend userlist</legend>

        <asp:GridView ID="GridViewUser" runat="server" AutoGenerateColumns="False"
            Height="30px" AllowPaging="True" onpageindexchanging="GridViewUser_PageIndexChanging" 
                            onrowdatabound="GridViewUser_RowDataBound" PageSize="15">
            <Columns>
                <asp:TemplateField HeaderText="Select">
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" />
                        <asp:Label ID="LabelRole" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"RoleId") %>' Visible="False"></asp:Label>
                        <asp:Label ID="LabelDept" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"DeptId") %>' Visible="False"></asp:Label>
                        
                    </ItemTemplate>
                    <ItemStyle Width="40px" />
                </asp:TemplateField>
                <asp:BoundField DataField="userId" HeaderText="UserID" ReadOnly="True">
                    <ItemStyle Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="userName" HeaderText="UserName" >
                    <ItemStyle Width="70px" />
                </asp:BoundField>
                <asp:BoundField DataField="englishName" HeaderText="EnglishName" >
                    <ItemStyle Width="75px" />
                </asp:BoundField>
                <asp:BoundField DataField="sex" HeaderText="Sex" >
                    <ItemStyle Width="40px" />
                </asp:BoundField>
                <asp:BoundField DataField="department" HeaderText="Department" >
                    <ItemStyle Width="80px" />
                </asp:BoundField>
                <asp:BoundField DataField="roleName" HeaderText="Role" >
                    <ItemStyle Width="80px" />
                </asp:BoundField>
                <asp:BoundField DataField="region" HeaderText="Region">
                    <ItemStyle Width="60px" />
                </asp:BoundField>
                <asp:BoundField DataField="officeTel" HeaderText="OfficeTel">
                <ItemStyle Width="120px" />
                </asp:BoundField>
                <asp:BoundField DataField="ExtensionTel" HeaderText="Extension">
                    <ItemStyle Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="mobile" HeaderText="Mobile">
                <ItemStyle Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="email" HeaderText="Email">
                <ItemStyle Width="120px" />
                </asp:BoundField>
            </Columns>
            <EmptyDataTemplate>
                <div>
                    ………………</div>
            </EmptyDataTemplate>
            <HeaderStyle CssClass="datagrid_headrstyle_normal" />
            <PagerSettings FirstPageText="FirstPage" LastPageText="LastPage" NextPageText="NextPage" 
                Mode="NextPreviousFirstLast" PreviousPageText="PreviousPage" 
                FirstPageImageUrl="~/images/main_54.gif" 
                LastPageImageUrl="~/images/main_60.gif" NextPageImageUrl="~/images/main_58.gif" 
                PreviousPageImageUrl="~/images/main_56.gif" />
            <FooterStyle CssClass="datagrid_footerstyle_normal" Height="20px" />
            <RowStyle HorizontalAlign="Center" Height="19px" />
            
        </asp:GridView>
</fieldset>&nbsp;
      
      <br />
      </td>
  <td style="background-image: url(../images/main_rs.gif)"></td>
  </tr>
  </table>
  </form>
</body>
</html>
